/**
 * 
 */
package com.quiz.activity.sections;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;

import com.quiz.activity.questions.QuestionActivity;
import com.quiz.model.Section;


/**
 *
 * @author Brian Boyle
 * Apr 11, 2012
 */
public class StartQuestionsClickListener implements OnClickListener {


    private Context context;
    private Section selectedSection;

    public StartQuestionsClickListener(Context context, Section section) {
        this.context = context;
        this.selectedSection = section;
    }

    /**
     * {@inheritDoc}
     */
    public void onClick(View view) {
        Intent startQuestionsIntent = new Intent(this.context, QuestionActivity.class);
        startQuestionsIntent.putExtra("sectionId", selectedSection.getId());
        startQuestionsIntent.putExtra("numberOfQuestionsInSection", selectedSection.getNumberOfQuestions());
        startQuestionsIntent.putExtra("questionCount", 1);

        //Don't log history for the QuestionActivity
        startQuestionsIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
        this.context.startActivity(startQuestionsIntent);
    }

}
